<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    {include file="layout:_meta" /}
    <title>详情</title>
</head>
<body>
<article class="cl pd-20">
    <form class="form form-horizontal" id="form-admin">
        
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">公司名称</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.company_name }}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">负责人姓名</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.name }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">职位</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.content }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">年龄</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.agemin }} - {{ model.agemax }}
            </div>
        </div>

         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">职位类型</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.type==1?'全职':'兼职' }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">区域</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.region_name }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">薪水</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.salary }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">性别要求:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span v-text="sex(model.sex)"> </span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">经验</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.experience }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">学历</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.education }}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">其他福利</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.welfare }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">阅读数</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.read }}
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">分享数</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.share }}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">收藏数 </label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.collect }}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">创建时间 </label>
            <div class="formControls col-xs-8 col-sm-9">
                <span v-text="gettime(model.ctime)"></span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">是否首页推荐：</label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.is_rec==1?'是':'否' }}
                <span v-on:click="updateInfo(model.id,'is_rec')"  class="btn btn-primary size-S radius">修改</span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">是否置顶 </label>
            <div class="formControls col-xs-8 col-sm-9">
                {{ model.is_top==1?'是':'否' }}
                <span v-on:click="updateInfo(model.id,'is_top')"  class="btn btn-primary size-S radius">修改</span>
            </div>
        </div>



    </form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="layout:_footer" /}
<!--/_footer 作为公共模版分离出去-->
<script type="text/javascript">

    var model = {
        covertemp:'',
        model: {

        }
    };
    
    var store_model = new Vue({
        el: "#form-admin",
        data: model,
        methods: {
            //限制输入特殊字符
            btKeyUp(e) {
                e.target.value = e.target.value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~！@#￥%……&*（）——\-+={}|《》？：“”【】、；‘’，。、]/g,"");
            },
            //上传封面
            onechangeImg: function(e) {
                var _this = this;
                var files = e.target.files;
                var image = new Image();
                image.crossOrigin = '';
                image.src = window.URL.createObjectURL(files.item(0));
                image.onload = function(){
                    _this.model.avatarUrl = util.getBase64Image(image);
                    _this.covertemp = image.src;
                    //console.log(_this.model.cover);
                }
            },

            //删除封面
            deleteOneImg:function() {
                this.model.avatarUrl = '';
            },
            doSubmit: function () {
                var _this = this;

                $.ajax({
                    type: 'post',
                    data: _this.model,
                    url: "{:url('user/set')}",
                    cache: false,
                    dataType: 'json',
                    success: function (ret) {
                        if (ret.status == true) {
                            layer.msg(ret.message, function () {
                                parent.location.href="{:url('user/index')}"+"?pageno="+{$pageno};
                                layer_close();
                            })
                        } else {
                            layer.msg(ret.message);
                        }
                    }
                });
            },
            sex:function(sex)
            {
                $sex = '未知';
                switch (sex) {
                    case 1:
                    $sex =  "男";
                    break;
                    case 2:
                        $sex =  "女";
                        break;
                    case 3:
                        $sex =  "男女不限";
                        break;
                }
                return $sex;
            },
            gettime:function (nS) {
                return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
            },
            updateInfo:function(id,field){
                // this.model['field'] =
                    switch(field) {
                        case 'is_rec':
                            this.model.is_rec = this.model.is_rec==1?2:1;
                            break;
                        case 'is_top':
                            this.model.is_top = this.model.is_top==1?2:1;
                            break;
                    }

                util.post("{:url('position/updateinfo')}", { id:"{$id}", data:this.model },function (data) {
                    store_model.model = data.data;   
                    layer.msg(data.message);
                });
            }
        }
    });

    util.get("{:url('position/info')}", {id:"{$id}"},function (data) {
        store_model.model = data.data;
        console.log(data.data);
    });


    

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>